import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type { AttactmentInfoQuery, AttactmentInfoVO } from "@/api/system/attact/info/types";

/**
 * 查询附件信息列表
 * @param query
 * @returns {*}
 */
export const listAttactmentInfo = (query?: AttactmentInfoQuery): AxiosPromise<AttactmentInfoVO[]> => {
  return request({
    url: "/file/attactmentInfo/list",
    method: "get",
    params: query
  });
};

/**
 * 删除附件信息
 * @param id
 */
export const delAttactmentInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: "/file/attactmentInfo/" + id,
    method: "delete"
  });
};

/**
 * 查询附件详细
 * @param id
 */
export const getAttactmentInfo = (id: string | number): AxiosPromise<AttactmentInfoVO> => {
  return request({
    url: "/file/attactmentInfo/" + id,
    method: "get"
  });
};

/**
 * 上传图片
 * @param data 上传请求附加数据
 */
export const upload = (data: any) => {
  return request({
    url: "/file/attactmentInfo/upload",
    method: "post",
    data: data
  });
};
